Skip to content

fix(actor): adapt PlatformEventManager to crawlee v4 EventManager API#594

Open
B4nan wants to merge 8 commits into
refactor/configuration-class-redesignfrom
fix/event-manager-v4-adapt
Open

fix(actor): adapt PlatformEventManager to crawlee v4 EventManager API#594
B4nan wants to merge 8 commits into
refactor/configuration-class-redesignfrom
fix/event-manager-v4-adapt

Conversation

@B4nan
Copy link
Copy Markdown
Member

@B4nan B4nan commented Apr 30, 2026

Summary

Crawlee v4's EventManager constructor changed:

  • Now requires EventManagerOptions (just persistStateIntervalMillis).
  • Base class no longer carries a config field — the previous override readonly config pattern is invalid.

This PR adapts PlatformEventManager:

  • Drops the override; stores config as own readonly property.
  • Forwards persistStateIntervalMillis to super().
  • Adds a fromConfig() factory mirroring LocalEventManager.fromConfig() so the SDK plays nicely with the new ServiceLocator init path.

Stacking

Depends on #583 (config redesign). Rebases cleanly onto v4 once #583 lands.

@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch from 4f65fb8 to f5d0e03 Compare April 30, 2026 19:14
@B4nan B4nan changed the base branch from v4 to refactor/configuration-class-redesign May 6, 2026 09:26
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch 5 times, most recently from 076c1eb to cc2c4dd Compare May 12, 2026 11:24
@B4nan B4nan force-pushed the refactor/configuration-class-redesign branch from 5491e94 to 691c7ce Compare May 12, 2026 11:40
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch 2 times, most recently from 89d0f5c to b4ea1e5 Compare May 12, 2026 11:56
@B4nan B4nan force-pushed the refactor/configuration-class-redesign branch from 7c740df to 28eab9a Compare May 12, 2026 12:18
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch from b4ea1e5 to fd14806 Compare May 12, 2026 12:18
B4nan added a commit that referenced this pull request May 12, 2026
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch from fd14806 to c1f975a Compare May 12, 2026 12:30
B4nan added a commit that referenced this pull request May 12, 2026
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch 2 times, most recently from 79c7560 to dec3f6c Compare May 12, 2026 14:32
B4nan added a commit that referenced this pull request May 12, 2026
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch from dec3f6c to 43cf6a4 Compare May 12, 2026 14:37
B4nan added a commit that referenced this pull request May 12, 2026
B4nan added a commit that referenced this pull request May 12, 2026
B4nan added a commit that referenced this pull request May 12, 2026
…anager API

Squashes the full content of #594 into a single commit
so the bundle PR shows a clean four-commit summary of the v4 catch-up
stack. See PR #594 for the per-commit history.
B4nan added 7 commits May 13, 2026 16:44
Crawlee v4's `EventManager` constructor now requires
`EventManagerOptions` (just `persistStateIntervalMillis`), and the
base class no longer carries a `config` field — the previous
`override readonly config` pattern is no longer valid.

- Drop the `override` and store `config` as own readonly property.
- Forward `persistStateIntervalMillis` to `super()`.
- Add a `fromConfig()` factory mirroring `LocalEventManager.fromConfig()`
  so the SDK plays nicely with the new ServiceLocator-driven init path.

Stacked on #583 (config redesign); rebases onto v4 once that lands.
`Configuration.useEventManager()` was removed in crawlee v4. Install
the platform event manager via the global service locator instead, and
reset between tests so each case can register a fresh manager without
hitting `ServiceConflictError`.
Crawlee v4's `Configuration` is eager — `actorEventsWsUrl` is read
once at construction, so a global config that pre-existed the
`beforeEach` would never see the websocket URL we set, and
`events.init()` would silently never connect. Move the env-var setup
above `Configuration.getGlobalConfig()` and reset the SDK's static
singleton so each test rebuilds a fresh config.
@B4nan B4nan force-pushed the fix/event-manager-v4-adapt branch from 43cf6a4 to f5f4e1b Compare May 13, 2026 14:45
B4nan added a commit that referenced this pull request May 13, 2026
…anager API

Squashes the full content of #594 into a single commit
so the bundle PR shows a clean four-commit summary of the v4 catch-up
stack. See PR #594 for the per-commit history.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants